package com.uzai.common.enums;

import java.util.Objects;

/**
 * @author mingyang.chen create in 2023/7/3 09:55
 */
public enum ManageRoleTypeEnum {

    DEFAULT(-1, "默认角色"),
    ADMIN(0, "管理员"),
    CS(1, "客服角色"),
    PR(2, "产品角色"),
    QA(3, "测试角色"),
    ;


    private final int code;

    private final String desc;

    ManageRoleTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * Gets by code.
     *
     * @param code the code
     * @return the by code
     */
    public static ManageRoleTypeEnum getByCode(Integer code) {
        for (ManageRoleTypeEnum roleTypeEnum : ManageRoleTypeEnum.values()) {
            if (Objects.equals(roleTypeEnum.getCode(), code)) {
                return roleTypeEnum;
            }
        }
        return null;
    }

    /**
     * Gets code.
     *
     * @return the code
     */
    public int getCode() {
        return code;
    }

    /**
     * Gets desc.
     *
     * @return the desc
     */
    public String getDesc() {
        return desc;
    }
}
